#ifndef YUNSHAN_STRING_H
#define YUNSHAN_STRING_H
#include <iostream>
#include "stringsegment.h"

namespace yunshan
{
using namespace std;
class LeeString
{
	StringBuf* m_strBuf;		
	char* data() const {return m_strBuf->m_str;}

	// constructor and destructor
	public:
	 LeeString():m_strBuf(NULL){}
	 LeeString(const char * str);
	 LeeString(LeeString & str);
	~LeeString();
	//attributes
	public:
	int getLength(){
	return m_strBuf==NULL?0:m_strBuf->m_strLen;
	}

	// operators	
	public:
	bool operator==(LeeString & str)
		{
			return true;
		}
	friend ostream & operator << (ostream& out,const LeeString &s)
		{
			out << s.data();
			return out;
		}
	LeeString& operator = (const LeeString & str);
	LeeString& operator = (const char* str);
	LeeString& operator + (const LeeString & str);
	LeeString& operator += (const LeeString & str);
	//methods
	public:
	//text search
	int find(const LeeString&, int);
	int find(const char, int s=0);
	int find(const char*, int);
	//text index
	int indexof(char, int);

	//substring
	LeeString substring(int,int);
};
}
#endif
